using System;
using System.Web.Mvc;
using AutoMapper;
using WebApp.ModelService;
using WebApp.Services;

namespace WebApp.Controllers
{    
    public class MemberController : SmartController
    {
        private readonly IMemberModelService _memberModelService;

        public MemberController(IUserSession userSession, IMappingEngine mappingEngine, IMemberModelService memberModelService)
            : base(userSession, mappingEngine)
        {
            _memberModelService = memberModelService;
        }

        [Authorize]
        public ViewResult Index()
        {
            return View(_memberModelService.GetPageBySpecification());
        }

        [Authorize]
        public ViewResult Show(Guid id)
        {
            var response = _memberModelService.GetMemberDetailById(id);
            return View(response);
        }

        [Authorize]
        public ViewResult Edit(Guid id)
        {
            var response = _memberModelService.GetMemberDetailById(id);
            return View(response);
        }

        public ViewResult Register()
        {
            return View();
        }

        public ViewResult Add()
        {
            var response = _memberModelService.GetMemberDetailById();
            return View(response);
        }
    }
}